package com.learn.oneday;


import org.apache.log4j.Logger;

/**
 * 线程创建方法
 *
 * @author ln
 * @Description: ${todo}
 * @date 2020/12/6
 */
public class ThreadCreate {

    private static final Logger logger = Logger.getLogger("ThreadCreate");

    public static void main(String[] args) {

//        法一：
        Thread t = new Thread() {
            @Override
            public void run() {
                logger.info("running");
            }
        };

        t.start();


        Runnable task=()->logger.info("running");


//        法二：
        Runnable r = new Runnable() {
            @Override
            public void run() {
                logger.debug("running");
            }
        };

        Thread t2=new Thread(r,"t2");
        t2.start();

    }




}
